﻿using Application.UserRoleService;
using Domain.Entity.zct;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace WMSManage.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UserRoleController : ControllerBase
    {
        private readonly IUserRoleService userroleService;

        public UserRoleController(IUserRoleService userroleService)
        {
            this.userroleService = userroleService;
        }

        /// <summary>
        /// 查询所有
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<UserRole>> GetAll()
        {
            return await userroleService.GetAll();
        }

        /// <summary>
        /// 查询所有:角色拼接
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<List<UserRolesDto>> GetAllUserRoles()
        {
            return await userroleService.GetAllUserRolesAsync();
        }

        /// <summary>
        /// 查询所有:ID
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public async Task<UpdateUserRoleDto> Getuid(int uid)
        {
            UpdateUserRoleDto updateUserRoleDto = await userroleService.Getuid(uid);
            return updateUserRoleDto;
        }
    }
}
